package com.nstar.carousel.utils
{
	public class CarouselCommonUtils
	{
		public function CarouselCommonUtils()
		{
		}
		
		private static function addTab(count:int=1):String{
			var r:String="";
			for(var i:int = 0;i<count;i++){
				r += String.fromCharCode(9);
			}
			return r;
		}
		
		public static function generateProductsXML(values:Array):String{
			var xml:String = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
			xml += "<products>\n";
			var i:int =1;
			for each(var item:String in values){
				xml += addTab()+"<product>\n";
				xml += addTab(2)+"<productId>"+i+"</productId>\n";
				xml += addTab(2)+"<title>"+item+"</title>\n";
				xml += addTab(2)+"<image>assets/products/"+item+".jpg</image>\n";
				xml += addTab(2)+"<description>This is "+item+",just a test.</description>\n";
				xml += addTab()+"</product>";
				xml += "\n";
				i++;
			}
			xml += "</products>";
			return xml;
		}

	}
}